package common;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Roi
 * Date: 11/17/13
 */
public class Utils {

    public static String fileToString(String filename) throws IOException {
        String line;
        String text = "";

        BufferedReader reader = new BufferedReader(new FileReader(filename));
        while ((line = reader.readLine()) != null) {
            text += line + "\n";
        }

        return text;
    }

    public static String prettyPrintList(List<? extends Object> list) {
        StringBuilder str = new StringBuilder();
        String d = "";
        for(Object item : list) {
            str.append(d);
            str.append(item);
            d = ", ";
        }
        return str.toString();
    }
}
